<?php
/**
 * Created by PhpStorm.
 * User: liuxiaojie
 * Date: 2019-06-18
 * Time: 16:09
 */

namespace app\mall\controller;

use app\common\BaseLoginCustomer;
use app\mall\service\LotteryService;
use think\Request;

class Lottery extends BaseLoginCustomer
{
    private $lotteryService;
    function __construct(Request $request = null, LotteryService $lotteryService)
    {
        parent::__construct($request);
        $this->lotteryService = $lotteryService;
    }

    function lists()
    {
        $param  = [
            'company_id'=> $this->getParam('company_id', 0)
        ];
        $data = $this->lotteryService->lists($param, $this->pageSize);
        return success($data);
    }

    function details()
    {
        $param = [
            'award_id'=> $this->getParam('award_id', 0)
        ];
        $customer_id = $this->getParam('u_id', 0);
        $data = $this->lotteryService->details($param, $customer_id);
        return success($data);
    }

    function lottery()
    {
        $param = [
            'parent_id'=> $this->getParam('parent_id', 0),
            'customer_id'=> $this->getParam('u_id', 0),
            'award_id'=> $this->getParam('award_id', 0)
        ];
        $this->lotteryService->lottery($param);
        return success([]);
    }

    function more()
    {
        $param = [
            'award_id'=> $this->getParam('award_id', 0)
        ];
        $data = $this->lotteryService->more($param, 32);
        return success($data);
    }

    function share()
    {
        $param = [
            'award_id'=> $this->getParam('award_id', 0),
            'customer_id'=> $this->getParam('u_id', 0)
        ];

        $data = $this->lotteryService->share($param);
        return success($data);
    }

    function details2()
    {
        $param = [
            'award_id'=> $this->getParam('award_id', 0)
        ];
        $customer_id = $this->getParam('u_id', 0);
        $data = $this->lotteryService->details2($param, $customer_id);
        return success($data);
    }

    function myList()
    {
        $param  = [
            'customer_id'=> $this->getParam('u_id', 0),
            'is_prize'=> $this->getParam('is_prize', 0)
        ];
        $data = $this->lotteryService->lists2($param, $this->pageSize);
        return success($data);
    }



}